package edu.colorado.karl.login;

/**
 * This class stores data on a single active session.
 * It is used by the Authenticate class, mainly for organizational purposes.
 * @author Addison LeMessurier
 * @version 5/4/08
 */

public class Session {
	private boolean admin; // true = administrator, false = residential user
	private int ID;	// unique ID value for this session
	private String username;	// owner of this session
	
	/**
	 * Constructor.
	 */
	public Session() {
		// nothing needs to be done here
	}

	/**
	 * This is a copy constructor.
	 * @param s The session to duplicate.
	 */
	public Session(Session s) {
		username = s.username;
		admin = s.admin;
		ID = s.ID;
	}

	/**
	 * Indicates whether or not this session has administrative privileges.
	 * @return <code>true</code> if the user has admin privileges.
	 */
	public boolean getAdmin() {
		return admin;
	}
	
	/**
	 * Gets the ID number for this session.
	 * @return the session ID number.
	 */
	public int getID() {
		return ID;
	}
	
	/**
	 * Gets the user name for this session.
	 * @return the name of the user this session belongs to.
	 */
	public String getUsername() {
		return username;
	}
	
	/**
	 * Modifies this session's administrative privileges.
	 * @param value Set to <code>true</code> to grant admin privileges to this
	 * session.
	 */
	public void setAdmin(boolean value) {
		admin = value;
	}
	
	/**
	 * Modifies this session's ID number.
	 * @param value The new ID number.
	 */
	public void setID(int value) {
		ID = value;
	}
	
	/**
	 * Modifies this session's user name.
	 * @param value The new user name for this session.
	 */
	public void setUsername(String value) {
		username = value;
	}
}
